package com.infonam.data.source.model;

import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="language", catalog="sakila")
public class Language {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="language_id", nullable=false,unique=true)
	private int language_id;
	@Column(name="name",nullable=false,length=20)
	private String name;
	@Column(name="last_update",nullable=false, columnDefinition="TIMESTAMP default CURRENT_TIMESTAMP on update TIMESTAMP")
	private Date last_update;
	@OneToMany(fetch=FetchType.LAZY, mappedBy="language_id")
	@Cascade({CascadeType.ALL})
	private List<Film> listFilm = new LinkedList<Film>();
	@OneToMany(fetch=FetchType.LAZY, mappedBy="original_language_id")
	@Cascade({CascadeType.ALL})
	private List<Film> listFilmOriginal = new LinkedList<Film>();
	public int getLanguage_id() {
		return language_id;
	}
	public void setLanguage_id(int language_id) {
		this.language_id = language_id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Date getLast_update() {
		return last_update;
	}
	public void setLast_update(Date last_update) {
		this.last_update = last_update;
	}
	public List<Film> getListFilm() {
		return listFilm;
	}
	public void setListFilm(List<Film> listFilm) {
		this.listFilm = listFilm;
	}
	public List<Film> getListFilmOriginal() {
		return listFilmOriginal;
	}
	public void setListFilmOriginal(List<Film> listFilmOriginal) {
		this.listFilmOriginal = listFilmOriginal;
	}
	
}
